package com.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.model.auto.Picture;
import com.service.IPictureService;
import com.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.lang.reflect.Type;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author astupidcoder
 * @since 2022-10-06
 */
@RestController
@RequestMapping("/picture")
public class PictureController{

    @Autowired
    private IPictureService pictureService;

    @GetMapping("/getPicture")
    public R getPicture(Integer type){
        List<Picture> list=pictureService.list(new LambdaQueryWrapper<Picture>()
                .eq(Picture::getType,type)
                .orderByAsc(Picture::getOrder)
                .eq(Picture::getDisplay,1)
        );
        return R.ok(list);
    }

}
